// 文件导出

export const exportFile = (fileData, name) => {
  if (!fileData.type) return
  const blob = new Blob([fileData], { type: "application/octet-stream;" })
  console.log(blob)
  let filename = name//下载的文件名
  if (window.navigator.msSaveOrOpenBlob) {
    navigator.msSaveBlob(blob, filename)
  } else {
    var link = document.createElement("a")
    const URL = window.URL || window.webkitURL
    const herf = URL.createObjectURL(blob)
    link.href = herf
    link.download = filename
    document.body.appendChild(link)
    link.click()

    URL.revokeObjectURL(link.href)
    document.body.removeChild(link)
  }
}